<?php 
include_once('connection/connection.php');
include('header.php');
include('menu.php');
include('config.php');
$frm=$_SESSION['form_id'];
$id1=$_SESSION['id1'];
$dis_name=$_SESSION['dis_name'];
$qr="select * from tbl_dtls_q2_main where form_id='$frm'";
$res=mysql_query($qr);
$row1=mysql_fetch_array($res);
if(isset($_POST['back']))
{ 
	header('Location: view_q2_1.php');
}	
if(isset($_POST['submit']))
{ 
	header('Location: view_q2_3.php');
}	
?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link href="css/style_question.css" type="text/css" rel="stylesheet" />
<title>View Q2</title>
<script language=javascript>
function show_NF()
{
	var val=document.getElementById('num').value;
	for(i=1; i<val; i++)
	{
		//alert(document.getElementById('functional_status'+i).innerHTML);
		if(document.getElementById('functional_status'+i).innerHTML == "NOT FUNCTIONAL")
		{
			document.getElementById('nf'+i).style.display = "block";
			document.getElementById('nonFuncDiv'+i).style.display = "none";
		}
		else
		{
			document.getElementById('nf'+i).style.display = "none";
			document.getElementById('nonFuncDiv'+i).style.display = "block";
		}
		
	}
}
</script>
</head>
<body onLoad="show_NF()">
<div align="center">
<form action="" method="post" enctype="multipart/form-data">
	<table border="0" width="958" id="table1" cellspacing="0" cellpadding="0">
		<tr>
			<td width="" height="30">
				<p align="center">
				<font face="Verdana" style="font-size: 10pt; font-weight: 700" color="#000000">
				Questionnaire No. 2</font>
		  	</td>
		</tr>
		<tr>
			<td height="20">
				<p align="center">
				<font face="Arial" style="font-size: 8.5pt" color="#000000">(For Hand Pump Schemes only)</font>
		  	</td>
		</tr>
		<tr>
			<td height="18">
				<p align="center">
				<font style="font-size: 8.5pt" face="Arial" color="#000000">Page 2</font></p>
			</td>
		</tr>
		<tr>
			<td><span style="font-weight: 700">
			<font face="Arial" style="font-size: 8.5pt" color="#000000">&nbsp;&nbsp;Form Id = <?php echo $frm?>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;District Name = <?php echo $dis_name?></font></span></td>
		</tr>
		<tr><td>&nbsp;</td></tr>
		<tr>
			<td bgcolor="#EEEEEE" height="20"><font color="#000000">&nbsp;
				<span style="font-weight: 700">
				<font face="Arial" style="font-size: 8.5pt">7. Water Source Details</font></span></font>
			</td>
		</tr>
		<tr>
			<td>
				<table border="1" width="958" id="table4" cellpadding="0" bgcolor="#FDF9EE" style="border-collapse:collapse; border-color:#99CCCC;">
					
					<tr>
						
						<td bgcolor="#F7E6B7" align="center" width="137" rowspan="0">
							<address>
		 			  <font style="font-size: 8.5pt; font-style: normal" face="Verdana" color="#990000">Habitation Name</font></address>					  </td>
					  <td bgcolor="#F7E6B7" align="center" width="46" rowspan="0">
							<address>
		 			  <font style="font-size: 8.5pt; font-style: normal" face="Verdana" color="#990000">Type of MH/OH</font></address>					  </td>
					  		<td bgcolor="#F7E6B7" align="center" width="103" rowspan="0">
							<address>
					  <font style="font-size: 8.5pt; font-style: normal" face="Verdana" color=                          	"#990000">&nbsp;&nbsp;Location of HP</font></address>				      </td>
						<td colspan="2" bgcolor="#F7E6B7" align="center" rowspan="0">
							<address>
				  			<font style="font-size: 8.5pt; font-style: normal" face="Verdana" color=                        	"#990000">Functional Status</font></address></td>
							<td><table width="500" border="1" style="border-collapse:collapse; border-color:#99CCCC;"><tr>
						<td width="104" colspan="0" rowspan="2" align="center" bgcolor="#F7E6B7">
							<address>
				  			<font style="font-size: 8.5pt; font-style: normal" face="Verdana" color=                        	"#990000">Operational status</font></address>						</td>
						<td width="86" colspan="0" rowspan="2" align="center" bgcolor="#F7E6B7">
							<address>
				  			<font style="font-size: 8.5pt; font-style: normal" face="Verdana" color=                         	"#990000">Quality Status</font></address>						</td>
						<td bgcolor="#F7E6B7" align="center" width="66" rowspan="2">
							<address>
				  			<font style="font-size: 8.5pt; font-style: normal" face="Verdana" color=                        	"#990000">Yield</font></address>					  </td>
						<td bgcolor="#F7E6B7" align="center" width="84" rowspan="2">
							<address>
				  			<font style="font-size: 8.5pt; font-style: normal" face="Verdana" color=                        	"#990000">Seasonal Fluctuation s in yield</font></address></td>
						<td height="21" colspan="2" align="center" bgcolor="#F7E6B7">
							<address>
				  			<font style="font-size: 8.5pt; font-style: normal" face="Verdana" color="#990000">Water Table Fluctuations (m)</font></address></td>
					</tr>
					<tr>
						<td width="63" height="16" align="center" bgcolor="#F7E6B7">
							<address>
		  			  <font style="font-size: 8.5pt; font-style: normal" face="Verdana" color="#990000">Min</font></address></td>
						<td bgcolor="#F7E6B7" align="center" width="69">
							<address>
		  			  <font style="font-size: 8.5pt; font-style: normal" face="Verdana" color="#990000">Max</font></address></td>
					</tr></table></td></tr>
					<?php
						$qr2="select * from tbl_dtls_q2_hp_status where q2_id='$id1' order by id";
						$res2=mysql_query($qr2);
						$i=1;
						while($row=mysql_fetch_array($res2))
						{
					?>
					<tr>
					  <td width="137" height="40" align="center"><label id="habitation_name"><font style="font-size: 8.5pt; font-style: normal" face="Verdana"><?php echo "$row[habitation_name]";?></font></label></td>
				      <td align="center" width="46"><label id="type_mh_oh"><font style="font-size: 8.5pt; font-style: normal" face="Verdana"><?php echo "$row[type_mh_oh]";?></label></td>
				      <td width="103" align="center"><label id="location"><font style="font-size: 8.5pt; font-style: normal" face="Verdana"><?php echo "$row[location]";?></font></label></td>
					  <td align="center" colspan="2"><label id="functional_status<?php echo $i ?>" for="<?php echo "$row[functional_status]";?>"><font style="font-size: 8.5pt; font-style: normal" face="Verdana"><?php echo "$row[functional_status]";?></font></label></td>
						<td width="500" align="center"><div id="nonFuncDiv<?php echo $i ?>">	
						 <table width="493" border="1" style="border-collapse:collapse; border-color:#99CCCC;">
						  <tr>
						<td width="99" align="center"><label id="operational_status"><font style="font-size: 8.5pt; font-style: normal" face="Verdana"><?php echo "$row[operational_status]";?></font></label></td>
						<td width="87" align="center"><label id="quality_status"><font style="font-size: 8.5pt; font-style: normal" face="Verdana"><?php echo "$row[quality_status]";?></font></label></td>
						<td width="65" align="center"><label id="yield"><font style="font-size: 8.5pt; font-style: normal" face="Verdana"><?php echo "$row[yield]";?></font></label></td>
						<td width="83" align="center"><label id="seasonal_fluctuation"><font style="font-size: 8.5pt; font-style: normal" face="Verdana"><?php echo "$row[seasonal_fluctuation]";?></font></label></td>
						<td width="62" align="center"><label id="water_table_min"><font style="font-size: 8.5pt; font-style: normal" face="Verdana"><?php echo "$row[water_table_min]";?></font></label></td>
						<td width="66" align="center"><label id="water_table_max"><font style="font-size: 8.5pt; font-style: normal" face="Verdana"><?php echo "$row[water_table_max]";?></font></label></td>
					</tr></table></div></td>
			  	  <tr>
					  		<td></td>
					  		<td></td>
							<td></td>
					  		<td colspan="2"><div id="nf<?php echo $i ?>">
							<table border="1" width="100%" id="table16" cellpadding="0" style="border-collapse:collapse; border-color:#99CCCC;">
							<tr>
								<td colspan="0" align="center" bgcolor="#F7E6B7">
									<font style="font-size: 8.5pt; font-style: normal" face="Verdana"                                	color="#990000">Repairable Status</font></td>
								<td width="84" rowspan="0" align="center" bgcolor="#F7E6B7"> 
									<font style="font-size: 8.5pt; font-style:normal" face="Verdana" color="#990000">Remarks (State means to repair &amp; rejuvenate)</font></td>
							<tr>
							  <td align="center" width="75"><label id="repairable_status"><font style="font-size: 8.5pt; font-style: normal" face="Verdana"><?php echo "$row[repairable_status]";?></font></label></td>
								<td width="84" align="center"><label id="remark"><font style="font-size: 8.5pt; font-style: normal" face="Verdana"><?php echo "$row[remark]";?></font></label></td>
							</tr>
							</table>
							</div></td>
			  	  </tr>
					<?php
					$i++; 
					}
					?>
					<input type="hidden" name="num" id="num" value="<?php echo $i;?>">
			  </table>
			</td>
		</tr>
		<tr>
			<td>&nbsp;</td>
		</tr>
		<tr>
			<td>
				<font style="font-size: 8.5pt" face="Arial" color="#000000">
			    &nbsp;&nbsp;Legends:</font><ul type="DISC">
				<li><font style="font-size: 8.5pt" face="Arial" color="#000000">
				Functional status:&nbsp; &nbsp;&nbsp;F - Functional, NF - Not Functional</font></li>
				<li><font style="font-size: 8.5pt" face="Arial" color="#000000">
				Operational Status:&nbsp; &nbsp;IU - In Use, OU - Out of Use</font></li>
				<li><font style="font-size: 8.5pt" face="Arial" color="#000000">
				Quality Status:&nbsp;&nbsp;P - Potable, NP - Not Potable</font></li>
				<li><font style="font-size: 8.5pt" face="Arial" color="#000000">
				Yield: &nbsp;&nbsp;&nbsp;G - Good, S - Satisfactory, P-Poor</font></li>
				<li><font style="font-size: 8.5pt" face="Arial" color="#000000">
				Seasonal Fluctuations: &nbsp;N - No Change, S - Slight Change, D - Drastic Change</font></li></ul>	
			</td>
		</tr>
		<tr>
			<td>&nbsp;</td>
		</tr>
		<tr>
			<td>&nbsp;</td>
		</tr>
			
		<tr>
			<td>&nbsp;</td>
		</tr>
		<tr>
			<td>&nbsp;</td>
		</tr>
		<tr>
			<td>
				<p align="center">
				<input type="submit" value="Back" name="back" style="font-size: 8pt;font-family:Verdana; border-style: solid; border-width: 1px">&nbsp;&nbsp;
				<input type="submit" value="Next" name="submit" style="font-size: 8pt; font-family: Verdana; border-style: solid; border-width: 1px">
			</td>
		</tr>
	</table>
</form>
</div>
</body>
</html>